//
//  ViewController.m
//  SampleApp
//
//  Created by 都书猛 on 2020/2/3.
//  Copyright © 2020 dsm. All rights reserved.
//

#import "ViewController.h"

@interface TestView : UIView

@end

@implementation TestView

- (instancetype)init
{
    self = [super init];
    if (self) {
        
    }
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
    return self;
}

- (void)willMoveToWindow:(UIWindow *)newWindow{
    [super willMoveToWindow:newWindow];
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
}

- (void)didMoveToWindow{
    [super didMoveToWindow];
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
}

- (void)willMoveToSuperview:(UIView *)newSuperview{
    [super willMoveToSuperview:newSuperview];
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
}

- (void)didMoveToSuperview{
    [super didMoveToSuperview];
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
}

@end


@interface ViewController ()

@end

@implementation ViewController

- (instancetype)init
{
    self = [super init];
    if (self) {
        
    }
    return self;
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIView *view1 = [[UIView alloc] init];
    view1.backgroundColor = [UIColor redColor];
    view1.frame = CGRectMake(100, 100, 100, 100);
    [self.view addSubview:view1];
    
    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(150, 150, 150, 150)];
    view2.backgroundColor = [UIColor greenColor];
    [self.view addSubview:view2];
    
    [self.view addSubview:({
        UILabel *label = [[UILabel alloc] init];
        label.text = @"Hello World";
        [label sizeToFit];
        label.center = CGPointMake(self.view.frame.size.width/2, self.view.frame.size.height/2);
        label;
    })];
    
    TestView *testView = [[TestView alloc] init];
    testView.backgroundColor = [UIColor blueColor];
    testView.frame = CGRectMake(200, 200, 200, 200);
    NSLog(@"Method:::%s,%d", __FUNCTION__, __LINE__);
    [self.view addSubview:testView];
    
}

@end
